/**
* 4   6   8   10  / 2 偶数
* 奇数  上一位+1
*/
class Solution {
    public int[] countBits(int num) {
        int[] total = new int[num + 1];
        for (int i = 1; i <= num; i++) {
            if (i % 2 == 0) {
                total[i] = total[i / 2];
            } else {
                total[i] = total[i - 1] + 1;
            }
        }
        return total;
    }
}